package com.example.apione.controller.index;

import com.example.apione.dao.ApiInfoDao;
import com.example.apione.entity.ApiInfo;
import com.example.apione.model.countApimodel;
import com.example.apione.model.getApimodel;
import com.example.apione.utils.ResponseResult;
import lombok.Data;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;


/**
 * @author 尘落
 * @date 2023/2/23
 */
@Data
@RestController
public class getApiAll {
    private final ApiInfoDao apiInfoDao;

    @GetMapping(value = "/api/getAllapi")
    //查询所有api
    public ResponseResult<List<ApiInfo>> Allapi(Model model) {
        return getApimodel.getall(apiInfoDao);
    }
    @GetMapping(value = "/api/getoneapi")
    //查询单个api
    public ResponseResult<ApiInfo> Alloneapi(Model mode, @RequestParam(value = "doc") String param) {
        return getApimodel.oneapi(apiInfoDao,param);
    }
    @GetMapping(value = "/api/getApiAccessList")
    //查询单个api
    public ResponseResult<List<ApiInfo>> getApiAccessList(Model mode) {
        return countApimodel.getApiAccessList(apiInfoDao);
    }

}
